#pragma once
#include "CMultiParentShareableDependencyObject.h"

class LayoutTransitionStorage;
class CStoryboard;


class CTransition :
	public CMultiParentShareableDependencyObject
{
protected: 
	CTransition(CCoreServices * pCore);
protected: 
	virtual ~CTransition();
public: 
	static HRESULT Create(CDependencyObject * * ppObject, CREATEPARAMETERS * pCreate);
	virtual XUINT32 GetTypeIndex() const;
	static HRESULT OnLayoutChanging(CUIElement * pTarget, struct XRECTF_WH finalRect);
	static HRESULT OnLayoutChanged(CUIElement * pTarget);
	static HRESULT ProcessLoadTrigger(CUIElement * pTarget, LayoutTransitionStorage * pStorage);
	static HRESULT ProcessLayoutTrigger(CUIElement * pTarget, LayoutTransitionStorage * pStorage);
	static HRESULT ProcessUnloadTrigger(CUIElement * pTarget, LayoutTransitionStorage * pStorage, xvector<CTransition *> & applicableTransitions);
	static HRESULT SetupTransition(CUIElement * pTarget, CTransition * pTransition, XFLOAT staggeredBegin);
	virtual HRESULT CreateStoryboards(CUIElement * pTarget, XFLOAT staggeredBegin, XINT32 * cStoryboards, CStoryboard * * pStoryboardArray, enum TransitionParent * pTransitionParent);
	virtual HRESULT ParticipateInTransitions(CUIElement * pTarget, enum TransitionTrigger trigger, XBOOL * pResult);
	static HRESULT CancelTransitions(CUIElement * pTarget);
	static HRESULT ValidateTransitionWasSetup(CUIElement * pTarget);
	static HRESULT AppendAllTransitionsNoAddRefs(CUIElement * pTarget, enum TransitionTrigger trigger, xvector<CTransition *> & applicableTransitions);
	static XBOOL HasTransitionAnimations(CUIElement *, enum TransitionTrigger);
	static XBOOL HasTransitionAnimations(CUIElement * pTarget);
	static XBOOL HasActiveTransition(CUIElement * pTarget, enum TransitionTrigger trigger);
	static XBOOL HasActiveTransition(CUIElement * pTarget);
	static XBOOL HasPossibleTransition(CUIElement * pTarget);
	static void SetInformationFromAnimation(CUIElement * pTarget, LayoutTransitionStorage * pStorage, XUINT32 nextGenerationCounter);
	static void SetNextGenerationInformationFromLayout(CUIElement * pTarget, LayoutTransitionStorage * pStorage, XUINT32 nextGenerationCounter);
	static HRESULT GetLayoutSlotDuringTransition(CUIElement * pTarget, struct XRECTF_WH * pLayoutSlot);
	static XBOOL GetAllowsTransitionsToRun(CUIElement * pTarget);
	XBOOL GetIsStaggeringEnabled();
	void SetIsStaggeringEnabled(XBOOL value);
private: 
	static HRESULT OnTransitionCompleted(struct Xcp_IDependencyObject * pSender, struct Xcp_IDependencyObject * pEventArgs);
	static XBOOL HasRunningTransitionAnimations(CUIElement * pTarget);
public: 
	CDependencyObject * m_pStaggerFunction;
private: 
	XBOOL m_isStaggeringEnabled;


};